const antProcess = {
  // 选择流程节点
  selectCurrentProcessNode(graph, id) {
    const node = graph.getCellById(id)
    if(!node) return

    node.setData({ isActive: true })
  },

  // 取消选择的节点
  cancelNoCurrentSelectNode(graph, currentId) {
    const nodes = graph.getCells()
    for(let i = 0; i < nodes.length; i++) {
      const node = nodes[i]
      if(!node) continue

      if(node.id !== currentId) {
        node.setData({ isActive: false })
      }
    }
  },

  // 取消指定的节点选择状态
  cancelSelectElement(graph, currentId) {
    const node = graph.getCellById(currentId)
    node.setData({ isActive: false })
  },

  //选中的节点
  getAllSelectNode(graph) {
    const nodeCells = graph.getCells()
    let selectNodeCells = []
    for(let i = 0; i < nodeCells.length; i++) {
      const { isActive } = nodeCells[i].getData()
      if(isActive != undefined && isActive) {
        selectNodeCells.push(nodeCells[i])
      }
    }
    return selectNodeCells
  }
}
export default antProcess